package com.framework.modules.dataview.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.framework.common.utils.PageUtils;
import com.framework.common.utils.Query;

import com.framework.modules.dataview.dao.ViewUserFullInfoDao;
import com.framework.modules.dataview.entity.ViewUserFullInfoEntity;
import com.framework.modules.dataview.service.ViewUserFullInfoService;


@Service("viewUserFullInfoService")
public class ViewUserFullInfoServiceImpl extends ServiceImpl<ViewUserFullInfoDao, ViewUserFullInfoEntity> implements ViewUserFullInfoService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        EntityWrapper wrapper=new EntityWrapper<ViewUserFullInfoEntity>();
        if(params.containsKey("is_live_streamer")){
            wrapper.eq("is_live_streamer",params.get("is_live_streamer"));
        }
        if(params.containsKey("nickname")){
            wrapper.like("nickname","%"+params.get("nickname")+"%");
        }
        if(params.containsKey("user_id")){
            wrapper.eq("user_id",params.get("user_id"));
        }
        if(params.containsKey("guild_id")){
            wrapper.eq("guild_id",params.get("guild_id"));
        }
        if(params.containsKey("is_verify_idcard")){
            wrapper.eq("is_verify_idcard",params.get("is_verify_idcard"));
        }
        Page<ViewUserFullInfoEntity> page = this.selectPage(
                new Query<ViewUserFullInfoEntity>(params).getPage(),
                wrapper.orderBy("create_time",false)
        );

        return new PageUtils(page);
    }

}
